// basic file operations
#include <iostream>
#include <fstream>
#include <conio.h>
#include "dynamicArray.h"
using namespace std;

int customAtoi(char c)
{
	if (c >= 48 && c <= 57)	//check to see that it is a number first
	{
		return c - 48;
	}
	return -1;	//Probably bad.  meh.
}

int main () {
	fstream inputFile;
	char x = 0;
	char y = 0;
	inputFile.open("example.txt");
	x = customAtoi(inputFile.get());
	y = customAtoi(inputFile.get());
	inputFile.ignore();	//Ignore the first newline.
	dynamicArray myArray/*(x, y)*/;
	inputFile.peek();
	while (!inputFile.eof())
	{
		switch(inputFile.peek())
		{
		case 13:	//carriage return
		case 61:	//Equals sign.  Not sure why it is displaying.
		case 205:	//Crazy horizontal pipe.
			{
				inputFile.ignore();
				break;
			}
		
		default:
			{
				myArray.add(inputFile.get());
				break;
			}
		}
	}
	for (int y = 0; y < myArray.height(); y++)
	{
		for(int x = 0; x < myArray.width(); x++)
		{
			if (myArray.get(x, y) != '=')
			{
				cout << myArray.get(x, y);
			}
		}
	}

	return 0;
}
